function [aircraft] = calcMTOWRaymer (aircraft, engines)

global errorToleranceLb
global emptyWeightHistoricalCoeffs

% calculates the crew weight
aircraft.weights.crew = calcCrewWeightLb( aircraft.nbCrew );

% calculates the payload weight
aircraft.weights.payload = calcPayloadWeightLb( aircraft.nbPax , aircraft.weights.load );

% calculates the fuel fraction
extraFuel = 0.06; % 6% of extrafuel
fuelWeightFraction = calcFuelWeightFraction ( aircraft, engines, extraFuel );

% initial value of mtow and error greater than the tolerance
aircraft.weights.mtow = 15000; % any value of the MTOW
weightErrorLb = 99; % error greater than the tolerance

% iterates until the error is smaller than the tolerance
while ( weightErrorLb > errorToleranceLb )
    
    aircraft.weights.empty = calcEmptyWeightLb (aircraft, emptyWeightHistoricalCoeffs(aircraft.idEngine) ) *...
        aircraft.weights.mtow;

    aircraft.weights.fuel = fuelWeightFraction * aircraft.weights.mtow ;
    
    calculatedMTOW = calcTakeOffWeight (aircraft, fuelWeightFraction);
    
    weightErrorLb = abs ( calculatedMTOW - aircraft.weights.mtow );
    
    aircraft.weights.mtow = calculatedMTOW;
    
    calculatedMTOW
end